package com.campus_information_portal.controller;

import com.campus_information_portal.entity.Teacher;
import com.campus_information_portal.service.TeacherService;
import com.campus_information_portal.util.Message;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author 20155883 万珊
 * @description 老师控制层
 * @project_name TeacherController
 * @package com.campus_information_portal.controller
 * @create 2018-05-17 14:33
 **/
@Controller
@RequestMapping("/teacher")
@ResponseBody
@CrossOrigin(origins = "*")
public class TeacherController {
    @Autowired
    TeacherService teacherService;

    /**
     * @Description 根据Teacher表中的老师编号查询老师个人信息
     * @author 20155883 万珊
     * @methodName queryTeacherByTeNum
     * @param teNum
     * @returnType Message
     * @create 2018/5/17 15:48
     **/
    @RequestMapping(value = "/queryTeacher",method = RequestMethod.GET)
    public Message queryTeacherByTeNum(@Param("teNum")int teNum){
        return teacherService.queryTeacherByTeNum(teNum);
    }


    /**
     * @param teacher
     * @Description 修改老师信息表（姓名，性别，身份证，出生年月，民族，电话，籍贯）
     * @author 20155880 房雁颖
     * @methodName updateTeacher
     * @returnType Message
     * @create 2018/4/26 15:26
     **/
    @RequestMapping(value = "/updateTeacher",method = RequestMethod.POST)
    public Message updateTeacher(@RequestBody Teacher teacher){
        return teacherService.updateTeacher(teacher);
    }
}
